Diffstat (limited to 'noncore/apps/advancedfm/output.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/output.cpp | 148 |
1 files changed, 145 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index 6970f58..82e78a7 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp | |||
@@ -4,13 +4,117 @@ | |||
4 | ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> | 4 | ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> |
5 | ****************************************************************************/ | 5 | ****************************************************************************/ |
6 | #include "output.h" | 6 | #include "output.h" |
7 | #include "inputDialog.h" | ||
7 | 8 | ||
9 | #include <qpe/filemanager.h> | ||
10 | #include <qpe/qpeapplication.h> | ||
11 | #include <qpe/applnk.h> | ||
12 | |||
13 | #include <qfile.h> | ||
14 | |||
15 | #include <qlineedit.h> | ||
8 | #include <qmultilineedit.h> | 16 | #include <qmultilineedit.h> |
9 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
10 | #include <qlayout.h> | 18 | #include <qlayout.h> |
11 | #include <qvariant.h> | 19 | #include <qvariant.h> |
12 | #include <qtooltip.h> | 20 | |
13 | #include <qwhatsthis.h> | 21 | /* XPM */ |
22 | static char * filesave_xpm[] = { | ||
23 | "16 16 78 1", | ||
24 | " c None", | ||
25 | ". c #343434", | ||
26 | "+ c #A0A0A0", | ||
27 | "@ c #565656", | ||
28 | "# c #9E9E9E", | ||
29 | "$ c #525252", | ||
30 | "% c #929292", | ||
31 | "& c #676767", | ||
32 | "* c #848484", | ||
33 | "= c #666666", | ||
34 | "- c #D8D8D8", | ||
35 | "; c #FFFFFF", | ||
36 | "> c #DBDBDB", | ||
37 | ", c #636363", | ||
38 | "' c #989898", | ||
39 | ") c #2D2D2D", | ||
40 | "! c #909090", | ||
41 | "~ c #AEAEAE", | ||
42 | "{ c #EAEAEA", | ||
43 | "] c #575757", | ||
44 | "^ c #585858", | ||
45 | "/ c #8A8A8A", | ||
46 | "( c #828282", | ||
47 | "_ c #6F6F6F", | ||
48 | ": c #C9C9C9", | ||
49 | "< c #050505", | ||
50 | "[ c #292929", | ||
51 | "} c #777777", | ||
52 | "| c #616161", | ||
53 | "1 c #3A3A3A", | ||
54 | "2 c #BEBEBE", | ||
55 | "3 c #2C2C2C", | ||
56 | "4 c #7C7C7C", | ||
57 | "5 c #F6F6F6", | ||
58 | "6 c #FCFCFC", | ||
59 | "7 c #6B6B6B", | ||
60 | "8 c #959595", | ||
61 | "9 c #4F4F4F", | ||
62 | "0 c #808080", | ||
63 | "a c #767676", | ||
64 | "b c #818181", | ||
65 | "c c #B8B8B8", | ||
66 | "d c #FBFBFB", | ||
67 | "e c #F9F9F9", | ||
68 | "f c #CCCCCC", | ||
69 | "g c #030303", | ||
70 | "h c #737373", | ||
71 | "i c #7A7A7A", | ||
72 | "j c #7E7E7E", | ||
73 | "k c #6A6A6A", | ||
74 | "l c #FAFAFA", | ||
75 | "m c #505050", | ||
76 | "n c #9D9D9D", | ||
77 | "o c #333333", | ||
78 | "p c #7B7B7B", | ||
79 | "q c #787878", | ||
80 | "r c #696969", | ||
81 | "s c #494949", | ||
82 | "t c #555555", | ||
83 | "u c #949494", | ||
84 | "v c #E6E6E6", | ||
85 | "w c #424242", | ||
86 | "x c #515151", | ||
87 | "y c #535353", | ||
88 | "z c #3E3E3E", | ||
89 | "A c #D4D4D4", | ||
90 | "B c #0C0C0C", | ||
91 | "C c #353535", | ||
92 | "D c #474747", | ||
93 | "E c #ECECEC", | ||
94 | "F c #919191", | ||
95 | "G c #7D7D7D", | ||
96 | "H c #000000", | ||
97 | "I c #404040", | ||
98 | "J c #858585", | ||
99 | "K c #323232", | ||
100 | "L c #D0D0D0", | ||
101 | "M c #1C1C1C", | ||
102 | " ...+ ", | ||
103 | " @#$%&..+ ", | ||
104 | " .*=-;;>,..+ ", | ||
105 | " ')!~;;;;;;{]..", | ||
106 | " ^/(-;;;;;;;_:<", | ||
107 | " [}|;;;;;;;{12$", | ||
108 | " #34-55;;;;678$+", | ||
109 | " 90ab=c;dd;e1fg ", | ||
110 | " [ahij((kbl0mn$ ", | ||
111 | " op^q^^7r&]s/$+ ", | ||
112 | "@btu;vbwxy]zAB ", | ||
113 | "CzDEvEv;;DssF$ ", | ||
114 | "G.H{E{E{IxsJ$+ ", | ||
115 | " +...vEKxzLM ", | ||
116 | " +...z]n$ ", | ||
117 | " +... "}; | ||
14 | 118 | ||
15 | Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) | 119 | Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) |
16 | : QDialog( parent, name, modal, fl ) | 120 | : QDialog( parent, name, modal, fl ) |
@@ -23,9 +127,18 @@ Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
23 | OutputLayout->setSpacing( 6 ); | 127 | OutputLayout->setSpacing( 6 ); |
24 | OutputLayout->setMargin( 11 ); | 128 | OutputLayout->setMargin( 11 ); |
25 | 129 | ||
130 | QPushButton *docButton; | ||
131 | docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); | ||
132 | docButton->setFixedSize( QSize( 20, 20 ) ); | ||
133 | connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); | ||
134 | // docButton->setFlat(TRUE); | ||
135 | OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); | ||
136 | |||
137 | |||
26 | OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); | 138 | OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); |
139 | OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); | ||
140 | |||
27 | 141 | ||
28 | OutputLayout->addWidget( OutputEdit, 0, 0 ); | ||
29 | } | 142 | } |
30 | 143 | ||
31 | /* | 144 | /* |
@@ -36,3 +149,32 @@ Output::~Output() | |||
36 | // no need to delete child widgets, Qt does it all for us | 149 | // no need to delete child widgets, Qt does it all for us |
37 | } | 150 | } |
38 | 151 | ||
152 | void Output::saveOutput() { | ||
153 | |||
154 | InputDialog *fileDlg; | ||
155 | fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); | ||
156 | fileDlg->exec(); | ||
157 | if( fileDlg->result() == 1 ) { | ||
158 | QString filename = QPEApplication::documentDir(); | ||
159 | if(filename.right(1).find('/') == -1) | ||
160 | filename+="/"; | ||
161 | QString name = fileDlg->LineEdit1->text(); | ||
162 | filename+="text/plain/"+name; | ||
163 | qDebug(filename); | ||
164 | |||
165 | QFile f(filename); | ||
166 | f.open( IO_WriteOnly); | ||
167 | if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { | ||
168 | DocLnk lnk; | ||
169 | lnk.setName(name); //sets file name | ||
170 | lnk.setFile(filename); //sets File property | ||
171 | lnk.setType("text/plain"); | ||
172 | if(!lnk.writeLink()) { | ||
173 | qDebug("Writing doclink did not work"); | ||
174 | } | ||
175 | } else | ||
176 | qWarning("Could not write file"); | ||
177 | f.close(); | ||
178 | |||
179 | } | ||
180 | } | ||